package com.woniuxy.service06;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 佘赛飞
 * @create 2021 -11 -04 5:30 PM
 */
public class SomeServiceTest {

    @Test
    public void test(){
        String path= "com/woniuxy/service06/applicationContext.xml";
        //相对路径 类路径 src根目录
        ApplicationContext ac=
                new ClassPathXmlApplicationContext(path);
        SomeService someService = (SomeService)ac.getBean("SomeService");
        //destory-method要执行，满足两个条件：
        //1、显示关闭容器，向下转型2、bean必须是单例的
        someService.doSome();
        ((ClassPathXmlApplicationContext)ac).close();
    }


}
